from django.shortcuts import render
from django.http import JsonResponse
from app.models import UserProfile
import uuid
from utils.RandomNumber import *
import random


def generate_random_userprofile():
    GENDER_CHOICES = ['M', 'F']
    MARITAL_CHOICES = ["未婚", "离异", "丧偶"]
    EDUCATION_CHOICES = ['初中', '高中', '大专', '本科', '硕士', '博士']
    INCOME_CHOICES = ['2千-3千', '3千-5千', '5千-8千', '8千-1万', '1万-2万', '2万-5万', '>5万']
    HOUSING_CHOICES = ["已购房(有贷款)", "已购房(无贷款)", "有能力购房", "无房", "无房希望望双方解决", "与父母同住",
                       "独自租房", "与人合租", "住单位房", "住亲朋家"]
    PET_CHOICES = ["猫", "狗", "鸟", "鱼", "兔", "鼠", "猪", "蛇", "乌龟", "爬行动物", "另类宠物", "其他宠物",
                   "正打算养", "不喜欢养", "能接受养宠物", "过敏"]
    HOBBY_CHOICES = ["旅行", "音乐", "看电影/综剧", "逛街购物", "运动健身", "养宠物", "徒步登山", "二次元", "书法绘画",
                     "看书", "摄影", "钓鱼", "打游戏", "宅家"]
    MARRIAGE_CHOICES = ["接爱", "两顾", "上门"]
    MARRIAGE_TIMIN_CHOICES = ["一年内", "两年内", '三年内', "五年内"]
    user_profile = UserProfile(
        avatar='https://example.com/avatar.jpg',
        gender=random.choice(GENDER_CHOICES),
        age=random.randint(18, 60),
        nickname='用户' + str(random.randint(1000, 9999)),
        birthdate='1990-01-01',
        marital_status=random.choice(MARITAL_CHOICES),
        height=random.randint(150, 200),
        weight=random.randint(40, 100),
        education=random.choice(EDUCATION_CHOICES),
        monthly_income=random.choice(INCOME_CHOICES),
        occupation='职业' + str(random.randint(1, 10)),
        housing_status=random.choice(HOUSING_CHOICES),
        car_status='购车情况' + str(random.randint(1, 5)),
        marriage_expectation='期望结婚时间' + str(random.randint(1, 5)),
        self_introduction='自我介绍内容' + str(random.randint(1, 100)),
        parental_involvement='父母帮征婚' + str(random.randint(1, 5)),
        wechat='wechat' + str(random.randint(1000, 9999)),
        wechat_QR='https://example.com/wechat_qr.jpg',
        qq='qq' + str(random.randint(1000, 9999)),
        parent_status='父母状态' + str(random.randint(1, 5)),
        live_with_parents='是否愿意与父母同住' + str(random.randint(1, 5)),
        smoking_status='吸烟情况' + str(random.randint(1, 5)),
        marriage_form=random.choice(MARRIAGE_CHOICES),
        children_status='子女情况' + str(random.randint(1, 5)),
        pets=random.choice(PET_CHOICES),
        hobbies=random.choice(HOBBY_CHOICES),
        blood_type='血型' + str(random.randint(1, 4)),
        ethnicity='民族' + str(random.randint(1, 10)),
        alma_mater='毕业院校' + str(random.randint(1, 100)),
        employer_type='单位类型' + str(random.randint(1, 5)),
        employer='工作单位' + str(random.randint(1, 100)),
        property_location='房产位置' + str(random.randint(1, 100)),
        location='位置' + str(random.randint(1, 100)),
        age_range=str(random.randint(20, 30)) + str(random.randint(30, 40)),
        height_range=str(random.randint(150, 160)) + str(random.randint(160, 180)),
        minimum_education=random.choice(EDUCATION_CHOICES),
        minimum_income=random.choice(INCOME_CHOICES),
        marriage_timing=random.choice(MARRIAGE_TIMIN_CHOICES),
        desired_housing_status='房子要求' + str(random.randint(1, 5)),
        desired_marital_status='期望婚姻状况' + str(random.randint(1, 5)),
        other_requirements='其他要求' + str(random.randint(1, 100)),
        realName='真实姓名' + str(random.randint(1, 100)),
        diplomaImage='https://example.com/diploma.jpg',
        carImage='https://example.com/car.jpg',
        houseImage='https://example.com/house.jpg',
        salaryImage='https://example.com/salary.jpg',
        work_time=random.randint(1, 40),
        my_province='省' + str(random.randint(1, 30)),
        my_city='市' + str(random.randint(1, 30)),
        my_area='区' + str(random.randint(1, 30)),
        work_province='工作省' + str(random.randint(1, 30)),
        work_city='工作市' + str(random.randint(1, 30)),
        work_area='工作区' + str(random.randint(1, 30)),
        desired_work_province='期望工作省' + str(random.randint(1, 30)),
        desired_work_city='期望工作市' + str(random.randint(1, 30)),
        desired_work_area='期望工作区' + str(random.randint(1, 30)),
        stick_status=bool(random.getrandbits(1)),
        hot_status=bool(random.getrandbits(1)),
        IDCode=randomNumber()
    )
    user_profile.save()
